package com.thering;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * author: the_ring
 * date: 2022/6/8
 * function: Movie info
 */
public class MovieInfoMapper extends Mapper<LongWritable, Text, Text, Text> {
    private String[] movie;
    private String name;
    private String rating;
    private String rating_count;

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        movie = value.toString().split("\t");
        name = movie[1];
        rating = movie[10];
        rating_count = movie[9];
        context.write(new Text(name), new Text(rating + " " + rating_count));
    }
}
